#pragma once
#include <QWidget>

#include "global.h"
#include <QJsonObject>

QT_BEGIN_NAMESPACE

namespace Ui
{
    class Register;
}

QT_END_NAMESPACE

class RegisterDialog final : public QWidget
{
    Q_OBJECT

public:
    explicit RegisterDialog(QWidget* parent = nullptr);

    ~RegisterDialog() override;

private:
    void showTip(const QString& text, bool is_ok) const;

    void initHttpHandlers();

private slots:
    void on_get_code_btn_clicked() const;

    void slot_reg_mod_finish(ReqId id, const QString& res, ErrorCodes err) const;

    //点击注册界面确认按钮
    void on_confirm_btn_clicked() const;

private:
    QMap<ReqId, std::function<void(const QJsonObject&)>> _handlers;

    Ui::Register* ui;
};
